package huawei.js2025;

import java.math.BigInteger;
import java.util.Scanner;

/**
 * 新的员工号
 */
public class Question6 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String trim = sc.nextLine().trim();
        sc.close();


        String[] split = trim.split(" ");
        String x = split[0];
        String y = split[1];


        int memberMinLen = getMemberMinLen(new BigInteger(x), Integer.parseInt(y));
        System.out.println(memberMinLen);
    }

    private static int getMemberMinLen(BigInteger x, int y) {
        if (x.compareTo(BigInteger.ZERO) == 0) return 0;

        if (y == 0) return -1;

        BigInteger pow26 = BigInteger.valueOf(26).pow(y);

        for (int i = 1; i < 20; i++) {
            BigInteger pow10 = BigInteger.TEN.pow(i);

            if (pow26.multiply(pow10).compareTo(x) >= 0) {
                return i;
            }
        }

        return -1;
    }
}
